
package com.jf.cloud.api.leaf.feign;

import com.jf.cloud.api.leaf.dto.SegmentDTO;
import com.jf.cloud.common.feign.FeignInsideAuthConfig;
import com.jf.cloud.common.response.ServerResponseEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 *
 * @author zz
 * @date 2020/09/08
 */
@FeignClient(value = "jfcloud-leaf",contextId ="segment")
public interface SegmentFeignClient {

    /**
     * 获取10位数的分布式id
     * @param key
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/segment")
    ServerResponseEntity<Long> getSegmentId(@RequestParam("key") String key);

    /**
     * 批量获取出入库商品项id
     * @param key
     * @param size
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_INSIDER_URL_PREFIX + "/batchGetSegmentId")
    ServerResponseEntity<List<Long>> batchGetSegmentId(@RequestParam("key") String key, @RequestParam("size") Integer size);

    /**
     * 批量获取10位数的分布式id
     * @param key
     * @param size
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/batchGetUserId")
    ServerResponseEntity<List<Long>> batchGetUserId(@RequestParam("key") String key, @RequestParam("size") Integer size);

    /**
     * 获取含有时间和用户id的分布式id
     * @param key
     * @param userId
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/getSegmentIdWithDateTime")
    ServerResponseEntity<Long> getSegmentIdWithDateTime(@RequestParam("key") String key,@RequestParam("userId") Long userId);


    /**
     * 批量获取订单相关的id
     * @param segmentDTO
     * @return
     */
    @GetMapping(value = FeignInsideAuthConfig.FEIGN_URL_PREFIX + "/insider/batchSegmentIdWithDateTime")
    ServerResponseEntity<Map<String, List<Long>>> batchSegmentIdWithDateTime(@RequestBody SegmentDTO segmentDTO);

}
